<!DOCTYPE html>
{% extends "bootstrap/base.html" %}

<!--标题模块-->
{% block title %}瑞典开心农场{% endblock %}

{% block head %}
    {{ super() }}
    <link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
    <link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
{% endblock %}

<!--导航栏模块-->
{% block navbar %}
    <div class="navbar navbar-inverse" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle"
                        data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="{{ url_for('index') }}">首页</a>
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li><a href="{{ url_for('duowan.index', channel='vid', page=1) }}">图库</a></li>
                    <li><a href="{{ url_for('documents.index') }}">文档</a></li>
                    <li><a href="{{ url_for('online_tools.index') }}">测试</a></li>
                    <li><a href="{{ url_for('books.feedback') }}">测试</a></li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    {% if g.username != 'anonymous' %}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                {#                        <img src="{{ current_user.gravatar(size=18) }}">#}
                                欢迎你，{{ g.username }}！ <b class="caret"></b>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="{{ url_for('users.profiles') }}">个人中心</a></li>
                                <li><a href="{{ url_for('users.password') }}">修改密码</a></li>
                                <li><a href="/">修改邮箱</a></li>
                                <li><a href="{{ url_for('users.logout') }}">退出登录</a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li><a href="{{ url_for('users.login') }}">登录</a></li>
                        <li><a href="{{ url_for('users.register') }}">注册</a></li>
                    {% endif %}
                    <li><a href="{{ url_for('background.index') }}">后台管理</a></li>
                </ul>
            </div>
        </div>
    </div>
{% endblock %}

<!--正文模块，包含了消息闪现元素，继承时继承其中的page_content模块-->
{% block content %}
    <div class="container">
        {# flask闪现消息相关渲染 #}
        {% for message in get_flashed_messages() %}
            <div class="alert alert-warning">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                {{ message }}
            </div>
        {% endfor %}

        <!--用于子模板继承改写内容-->
        {% block page_content %}
            <div class="page-header">
                <h1>Hello, Bootstrap!</h1>
            </div>
        {% endblock %}

    </div>
{% endblock %}


{% block scripts %}
    {{ super() }}
    {# 加载flask-moment所需资源 #}
    {{ moment.include_moment(local_js=url_for('static', filename='js/moment-with-locales.min.js')) }}
    {{ moment.locale(auto_detect=True) }}
{% endblock %}

